import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
//引入Windi css
import WindiCSS from "vite-plugin-windicss";
//引入path
import path from "path";
//引入UnoCSS
import UnoCSS from "unocss/vite";
import { presetAttributify, presetIcons, presetUno } from 'unocss'
// import { rules, shortcuts } from '~/utils/my_uno.js'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "~": path.resolve(__dirname, "src"),
    },
  },
  //配置接口跨域处理
  server: {
    proxy: {
      "/api": {
        target: "http://ceshi13.dishait.cn",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
  plugins: [
    vue(),
    WindiCSS(),
    UnoCSS({
      mode: "shadow-dom",
      presets: [
        presetUno(),
        presetAttributify(),
        presetIcons(),
      ],   
      // rules,
      // shortcuts,
    }),
  ],
});
